package ytmc.setup;


/**
 * List of all supported video resolutions
 *
 * @author Kicok
 */
public enum VideoResolution
{
    RES_ORIGINAL( "Rozdzielczość oryginalna" ),
    RES_1920x1080( "1920x1080" ),
    RES_1280x720( "1280x720" ),
    RES_854x480( "854x480" ),
    RES_570x320( "570x320" ),
    RES_800x600( "800x600" ),
    RES_640x480( "640x480" ),
    RES_480x320( "480x320" ),
    RES_320x240( "320x240" ),
    RES_240x160( "240x160" ),
    RES_160x120( "160x120" );


    private VideoResolution( String friendlyName )
    {
        this.friendlyName = friendlyName;
    }


    private String friendlyName;

    public String getFriendlyName()
    {
        return friendlyName;
    }


    public static final VideoResolution DEFAULT_RESOLUTION = VideoResolution.RES_ORIGINAL;

    public static VideoResolution get( int i )
    {
        return VideoResolution.values()[i];
    }

    public static VideoResolution get( String friendlyName )
    {
        return get( friendlyName, DEFAULT_RESOLUTION );
    }

    public static VideoResolution get( String friendlyName, VideoResolution defaultVideoResolution )
    {
        for( VideoResolution videoResolution : VideoResolution.values() )
        {
            if( videoResolution.getFriendlyName().equalsIgnoreCase( friendlyName ) )
            {
                return videoResolution;
            }
        }

        return defaultVideoResolution;
    }


    public static String[] friendlyNames()
    {
        int i = 0;
        int len = VideoResolution.values().length;

        String[] friendlyNames = new String[len];
        for( VideoResolution videoResolution: VideoResolution.values() )
        {
            friendlyNames[i] = videoResolution.getFriendlyName();
            i++;
        }

        return friendlyNames;
    }
}
